package com.itcast.nacos.demo.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
@RefreshScope  //动态刷新
public class NacosDemoConfigApplication {

    @Value(value = "${stockName:中国平安}")
    private String stockName;

    //提供股票名称的访问接口
    @RequestMapping("/getStockName")
    public String getStockName() {
        return "股票名称："+stockName;
    }

    public static void main(String[] args) {
        SpringApplication.run(NacosDemoConfigApplication.class,args);
    }
}
